<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
    <meta charset="utf-8">
    <title>登录</title>
    <script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
</head>

<body>
<div>
    <div>
        <span id="basic-addon1">邮箱</span>
        <input id="email" name="email" type="text" aria-describedby="basic-addon1" />
    </div>
    <br/>
    <div>
        <span id="basic-addon2">密码</span>
        <input id="password" name="password" type="password" aria-describedby="basic-addon2" />
    </div>
    <br/>
    <button id="login" name="login" type="button" style="width:170px;">登 录</button>
    <br/>
    <a href="http://www.test.com/static/register.html">注册新账号</a>
</div>
</body>
<script type="text/javascript">
    $("#login").click(function() {
        var email=document.getElementById("email").value;
        var password=document.getElementById("password").value;
        $.ajax({
            url: "http://www.test.com/api/user/login/" + email + "/" + password,
            type: "GET",
            success: function(data) {
                if(data == email){
                    window.location.href='http://www.test.com/static/welcome.html?email=' + email;
                } else {
                    alert("登录失败")
                }
            }
        });
    });
</script>

</html>